import {
  Table,
  Column,
  Model,
  CreatedAt,
  UpdatedAt,
  HasMany,
} from 'sequelize-typescript';
import { Project } from 'src/project/project.entity';

@Table({
  tableName: 'user',
})
export class User extends Model<User> {
  @Column({
    primaryKey: true,
  })
  id: number;

  @Column
  uuid: string;

  @Column
  name: string;

  @Column
  age: number;

  @Column
  gender: number;

  @Column
  tel: number;

  @Column({ field: 'identity_number' })
  identityNumber: string;

  @Column({ field: 'medical_aliance' })
  medicalAliance: number;

  @Column
  username: string;

  @Column
  password: string;

  @Column
  roles: string;

  @CreatedAt
  @Column({ field: 'created_at' })
  createdAt: Date;

  @UpdatedAt
  @Column({ field: 'updated_at' })
  updatedAt: Date;

  @HasMany(() => Project)
  projects: Project[];
}
